<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>AbstractController::Rendering</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Module</span> 
            AbstractController::Rendering 
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/actionpack/lib/abstract_controller/rendering_rb.html">actionpack/lib/abstract_controller/rendering.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  
    <!-- Namespace -->
    <div class="sectiontitle">Namespace</div>
    <ul>
      
        <li>
          <span class="type">MODULE</span>
          <a href="Rendering/ClassMethods.html">AbstractController::Rendering::ClassMethods</a>
        </li>
      
    </ul>
  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>R</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Rendering.html#method-i-render">render</a>,
              </li>
            
              
              <li>
                <a href="Rendering.html#method-i-render_to_body">render_to_body</a>,
              </li>
            
              
              <li>
                <a href="Rendering.html#method-i-render_to_string">render_to_string</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>V</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Rendering.html#method-i-view_assigns">view_assigns</a>,
              </li>
            
              
              <li>
                <a href="Rendering.html#method-i-view_context">view_context</a>,
              </li>
            
              
              <li>
                <a href="Rendering.html#method-i-view_context_class">view_context_class</a>,
              </li>
            
              
              <li>
                <a href="Rendering.html#method-i-view_renderer">view_renderer</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  
    <!-- Includes -->
    <div class="sectiontitle">Included Modules</div>
    <ul>
      
        <li>
          
            <a href="ViewPaths.html">
              AbstractController::ViewPaths
            </a>
          
        </li>
      
    </ul>
  



  

    

    

    
      <!-- Section constants -->
      <div class="sectiontitle">Constants</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class="attr-name">DEFAULT_PROTECTED_INSTANCE_VARIABLES</td>
            <td>=</td>
            <td class="attr-value">[
:@_action_name, :@_response_body, :@_formats, :@_prefixes, :@_config,
:@_view_context_class, :@_view_renderer, :@_lookup_context
]</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
      </table>
    


    


    <!-- Methods -->
        
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-render">
            
              <b>render</b>(*args, &amp;block)
            
            <a href="Rendering.html#method-i-render" name="method-i-render" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Normalize arguments, options and then delegates <a
href="Rendering.html#method-i-render_to_body">#render_to_body</a> and
sticks the result in self.response_body.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-render_source')" id="l_method-i-render_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/0c5552a3dd28e35cce64462765cc41c5355db0f1/actionpack/lib/abstract_controller/rendering.rb#L95" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-render_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/abstract_controller/rendering.rb, line 95</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">render</span>(*<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">_normalize_render</span>(*<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">response_body</span> = <span class="ruby-identifier">render_to_body</span>(<span class="ruby-identifier">options</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-render_to_body">
            
              <b>render_to_body</b>(options = {})
            
            <a href="Rendering.html#method-i-render_to_body" name="method-i-render_to_body" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Raw rendering of a template. :api: plugin</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-render_to_body_source')" id="l_method-i-render_to_body_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/0c5552a3dd28e35cce64462765cc41c5355db0f1/actionpack/lib/abstract_controller/rendering.rb#L118" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-render_to_body_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/abstract_controller/rendering.rb, line 118</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">render_to_body</span>(<span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">_process_options</span>(<span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">_render_template</span>(<span class="ruby-identifier">options</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-render_to_string">
            
              <b>render_to_string</b>(*args, &amp;block)
            
            <a href="Rendering.html#method-i-render_to_string" name="method-i-render_to_string" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Raw rendering of a template to a string.</p>

<p>It is similar to render, except that it does not set the response_body and
it should be guaranteed to always return a string.</p>

<p>If a component extends the semantics of response_body (as Action Controller
extends it to be anything that responds to the method each), this method
needs to be overridden in order to still return a string. :api: plugin</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-render_to_string_source')" id="l_method-i-render_to_string_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/0c5552a3dd28e35cce64462765cc41c5355db0f1/actionpack/lib/abstract_controller/rendering.rb#L111" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-render_to_string_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/abstract_controller/rendering.rb, line 111</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">render_to_string</span>(*<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">_normalize_render</span>(*<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">render_to_body</span>(<span class="ruby-identifier">options</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-view_assigns">
            
              <b>view_assigns</b>()
            
            <a href="Rendering.html#method-i-view_assigns" name="method-i-view_assigns" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>This method should return a hash with assigns. You can overwrite this
configuration per controller. :api: public</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-view_assigns_source')" id="l_method-i-view_assigns_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/0c5552a3dd28e35cce64462765cc41c5355db0f1/actionpack/lib/abstract_controller/rendering.rb#L138" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-view_assigns_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/abstract_controller/rendering.rb, line 138</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">view_assigns</span>
  <span class="ruby-identifier">hash</span> = {}
  <span class="ruby-identifier">variables</span>  = <span class="ruby-identifier">instance_variables</span>
  <span class="ruby-identifier">variables</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">protected_instance_variables</span>
  <span class="ruby-identifier">variables</span> <span class="ruby-operator">-=</span> <span class="ruby-constant">DEFAULT_PROTECTED_INSTANCE_VARIABLES</span>
  <span class="ruby-identifier">variables</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">name</span>[<span class="ruby-number">1</span><span class="ruby-operator">..</span><span class="ruby-number">-1</span>]] = <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-identifier">name</span>) }
  <span class="ruby-identifier">hash</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-view_context">
            
              <b>view_context</b>()
            
            <a href="Rendering.html#method-i-view_context" name="method-i-view_context" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>An instance of a view class. The default view class is <a
href="../ActionView/Base.html">ActionView::Base</a></p>

<p>The view class must have the following methods: View.new[lookup_context,
assigns, controller]</p>

<pre>Create a new ActionView instance for a controller</pre>

<p><a href="http://options">View#render</a></p>

<pre>Returns String with the rendered template</pre>

<p>Override this method in a module to change the default behavior.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-view_context_source')" id="l_method-i-view_context_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/0c5552a3dd28e35cce64462765cc41c5355db0f1/actionpack/lib/abstract_controller/rendering.rb#L84" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-view_context_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/abstract_controller/rendering.rb, line 84</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">view_context</span>
  <span class="ruby-identifier">view_context_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">view_renderer</span>, <span class="ruby-identifier">view_assigns</span>, <span class="ruby-keyword">self</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-view_context_class">
            
              <b>view_context_class</b>()
            
            <a href="Rendering.html#method-i-view_context_class" name="method-i-view_context_class" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-view_context_class_source')" id="l_method-i-view_context_class_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/0c5552a3dd28e35cce64462765cc41c5355db0f1/actionpack/lib/abstract_controller/rendering.rb#L71" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-view_context_class_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/abstract_controller/rendering.rb, line 71</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">view_context_class</span>
  <span class="ruby-ivar">@_view_context_class</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">view_context_class</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-view_renderer">
            
              <b>view_renderer</b>()
            
            <a href="Rendering.html#method-i-view_renderer" name="method-i-view_renderer" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns an object that is able to render templates.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-view_renderer_source')" id="l_method-i-view_renderer_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/0c5552a3dd28e35cce64462765cc41c5355db0f1/actionpack/lib/abstract_controller/rendering.rb#L89" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-view_renderer_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/abstract_controller/rendering.rb, line 89</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">view_renderer</span>
  <span class="ruby-ivar">@_view_renderer</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">ActionView</span><span class="ruby-operator">::</span><span class="ruby-constant">Renderer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">lookup_context</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    